Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(macos)!: add homebrew formula and drop dmg #2222

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Mar 6, 2024

Description

This PR will add a homebrew forumla for Sunshine.

Todo:

  • Adjust CI and CMake to configure the brew spec file, and build sunshine using the spec (similar to the Portfile)
  • Add a LizardByte homebrew repo, similar to https://github.com/LizardByte/jellyfin-plugin-repo
  • Create an action to use for publishing the final homebrew spec to the repo created
  • Update docs, specifically macOS installation instructions

References:

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@ReenigneArcher ReenigneArcher force-pushed the build(macos)-add-homebrew-formula branch 11 times, most recently from 00f41d2 to d2cc861 Compare March 7, 2024 03:47
@ReenigneArcher ReenigneArcher force-pushed the build(macos)-add-homebrew-formula branch 8 times, most recently from ab5cbbb to 9a9911d Compare March 7, 2024 15:43
@ReenigneArcher
Copy link
Member Author

ReenigneArcher commented Mar 7, 2024

I think we should also drop the standard macOS build as part of this. It will save 3 runners, and the artifacts produced by the build are not actually usable due to missing deps and the linking used doesn't allow it to be standalone like on Windows.

The homebrew install will be very easy compared to the macports build as well... essentially it will be a single terminal command to install sunshine through homebrew.

@ReenigneArcher ReenigneArcher force-pushed the build(macos)-add-homebrew-formula branch 4 times, most recently from 911bcf6 to 7eaf4b4 Compare March 7, 2024 22:47
#WebUI build
add_custom_target(web-ui ALL
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
COMMENT "Installing NPM Dependencies and Building the Web UI"
COMMAND bash -c \"npm install && SUNSHINE_SOURCE_ASSETS_DIR=${SUNSHINE_SOURCE_ASSETS_DIR} SUNSHINE_ASSETS_DIR=${CMAKE_BINARY_DIR} npm run build\") # cmake-lint: disable=C0301
COMMAND bash -c \"npm install && SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW} SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR} SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR} npm run build\") # cmake-lint: disable=C0301
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vite build fails if we provide a full path to the directories

Comment on lines 3 to 10
class @PROJECT_NAME@ < Formula
desc "@PROJECT_DESCRIPTION@"
homepage "@PROJECT_HOMEPAGE_URL@"
url "@GITHUB_CLONE_URL@",
tag: "@GITHUB_BRANCH@"
version "@PROJECT_VERSION@"
license all_of: ["GPL-3.0-only"]
head "@GITHUB_CLONE_URL@"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is configured just like the Portfile, flatpak, etc.

packaging/macos/sunshine.rb Show resolved Hide resolved
test do
# test that the binary runs at all
output = shell_output("#{bin}/sunshine --version").strip
puts output
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this the output is suppressed

@ReenigneArcher ReenigneArcher marked this pull request as ready for review March 7, 2024 22:52
@ReenigneArcher ReenigneArcher force-pushed the build(macos)-add-homebrew-formula branch 2 times, most recently from 2bebc23 to e855534 Compare March 7, 2024 23:03
@ReenigneArcher
Copy link
Member Author

@RealHQ would you mind reviewing this?

homebrew repo will be here: https://github.com/LizardByte/homebrew

The action that publishes the tap has been tested here: https://github.com/LizardByte/homebrew-release-action/tree/tests

New docs for homebrew are here: https://lizardbyte--2222.org.readthedocs.build/projects/sunshine/en/2222/about/setup.html#install

And the generated spec file can be seen in the CI here: https://github.com/LizardByte/Sunshine/actions/runs/8195989432/job/22415345732?pr=2222#step:4:61

@ReenigneArcher ReenigneArcher force-pushed the build(macos)-add-homebrew-formula branch 6 times, most recently from 394cd56 to 659e0d7 Compare March 8, 2024 01:13
@ReenigneArcher ReenigneArcher added this to the v0.22.1 milestone Mar 8, 2024
@ReenigneArcher
Copy link
Member Author

The core parts of this PR will remain the same, but...

I think I'm going to modify the action to do more of the heavy lifting.

  1. Provide it a specific formula as an input
  2. Have the action run the install
  3. Have the action run the tests
  4. Audit the formula (https://docs.brew.sh/Formula-Cookbook#audit-the-formula)

And for the future:

  1. Fork https://github.com/Homebrew/homebrew-core if it doesn't exist in the org already
  2. Checkout the fork
  3. Create a branch for the formula, and commit the changes
  4. Create/update a PR to upstream

cgutman
cgutman previously approved these changes Mar 8, 2024
Copy link
Collaborator

@cgutman cgutman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me, though I'm by no means an expert in Homebrew packaging.

@ReenigneArcher ReenigneArcher force-pushed the build(macos)-add-homebrew-formula branch 3 times, most recently from 986a0c8 to 6e733aa Compare March 9, 2024 14:54
@ReenigneArcher ReenigneArcher force-pushed the build(macos)-add-homebrew-formula branch from 6e733aa to 066dfa8 Compare March 9, 2024 15:18
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.18)

# todo - set version to 0.0.0 once confident in automated versioning
project(Sunshine VERSION 0.22.0
DESCRIPTION "Sunshine is a self-hosted game stream host for Moonlight."
DESCRIPTION "Self-hosted game stream host for Moonlight"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was modified to appease the homebrew audit step. The same complaints were presented by the Macports team previously, and I think the Flatpak team.

@ReenigneArcher ReenigneArcher changed the title build(macos): add homebrew formula build(macos)!: add homebrew formula and drop dmg Mar 9, 2024
@ReenigneArcher ReenigneArcher merged commit 33e99e1 into nightly Mar 9, 2024
48 checks passed
@ReenigneArcher ReenigneArcher deleted the build(macos)-add-homebrew-formula branch March 9, 2024 15:47
KuleRucket pushed a commit to KuleRucket/Sunshine that referenced this pull request Jun 6, 2024
@tristan-k
Copy link

tristan-k commented Jul 20, 2024

Why isn't the thomebrew formula up to date with the latest sunshine.rb release ? There is also the homebrew head flag in case that it isn't updated because it is a beta releease.

brew tap LizardByte/homebrew
brew install --HEAD sunshine

@ReenigneArcher
Copy link
Member Author

head only works if the build process hasn't changed

@tristan-k
Copy link

What a bummer. Is there another way to use the sunshine.rb with homebrew or some documentation?

@ReenigneArcher
Copy link
Member Author

Latest stable version should work with brew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Any interest in a Homebrew formula for sunshine Improve MacOS packaging
4 participants